{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
	<article>
		<div class="top-title">
			<dl>
				<dt><h1>{{.title}}</h1></dt>
				<dd><form method="get"><input type="text" class="input" placeholder="请输入您需要搜索的产品名称！" name="search"><input type="submit" value="搜索" class="button" /></form></dd>
			</dl>
		</div>
		<div class="nav1">
			<ul>
			</ul>
		</div>
		<div class="content">
			<div class="release">
				<dl>
					<dt><i class="iconfont">&#xe649;</i> <b>{{.title}}说明</b><br>
						下方是{{.title}}列表,可以进行添加,修改,删除<br>
						<p> <mark>未审核</mark>的产品将不会在小程序中显示,先按是否推荐对产品排序,然后排序数字越大产品位置越靠前</p>
					</dt>
					<dd><a href="/admin/product/add"><button type="button" class="button">添加产品</button></a></dd>
				</dl>
			</div>
			<table class="table">
				<thead><th>用户</th><th>产品标题</th><th>内容</th><th>评论时间</th><th>操作</th></thead>
				{{range .info}}
				<tr id="{{.id}}">
					<td class="center"><img src="{{.pathname}}" class="img-1"><br>{{.monicker}}</td>
					<td>
						<a href="/admin/product/content?id={{.pid}}" class="tz">{{.title}}</a>
					</td>
					<td>
						评分：{{.score}}<br>
						内容：{{.content}}
					</td>
					<td>
						评论时间：{{.addtime}}
					</td>
					<td class="operation">
						<a class="change" data-id="{{.id}}" data-status="censoring">{{if eq .censoring "1"}}已审核{{else}}未审核{{end}}</a><br>
						<a href="/admin/product/evaluation_content?id={{.id}}">详情</a><br>
						<a class="del" data-id="{{.id}}">删除</a>
					</td>
				</tr>
				{{end}}
				{{if ne .paginator.totalpages 1}}
				<tr>
					<td  colspan="5">
						<div class="paging">
							{{if ne .paginator.currpage 1}}
							<a href="{{$.url}}page={{.paginator.firstpage}}">首页</a>
							<a href="{{$.url}}page={{.paginator.prevpage}}">&lt;&lt;</a>
							{{else}}
							<a class="disable">首页</a>
							<a class="disable">&lt;&lt;</a>
							{{end}}
							{{range $index,$page := .paginator.pages}}
							{{if eq $.paginator.currpage $page}} 
							<a class="no">{{$page}}</a>
							{{else}}
							<a href="{{$.url}}page={{$page}}">{{$page}}</a>
							{{end}}
							{{end}}
							{{if eq .paginator.currpage .paginator.totalpages}}
							<a class="disable">&gt;&gt;</a>
							<a class="disable">尾页</a>
							{{else}}
							<a href="{{$.url}}page={{.paginator.nextpage}}">&gt;&gt;</a>
							<a href="{{$.url}}page={{.paginator.totalpages}}">尾页</a>
							{{end}}
						</div>
					</td>
				</tr>
				{{end}}
			</table>


		</div>
	</article>
</section>

<footer><!-- 系统监控内容 --></footer>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
<script>
    $('.del').click(function(){
		var id=$(this).attr('data-id');
		wxc.xcConfirm("您确定要删除这条数据吗?","confirm",{onOk:function(){
			$.ajax({
				url:'/admin/del',
				data:{table:'mt_product_evaluation',id:id},
				type:'get',
				success:function(res) {
					if(res==1){
						showMessage('删除成功');
						$('#'+id).css('display','none');
					}else{
						wxc.xcConfirm("操作失败,请重试","error");
					}
				}
			})	
		}});
	})
	$('.change').click(function(){
		var id=$(this).attr('data-id');
		var status=$(this).attr('data-status');
		var that=$(this)
		// wxc.xcConfirm("您确定要删除这条数据吗?","confirm",{onOk:function(){
			$.ajax({
				url:'/admin/change',
				data:{table:'mt_product_evaluation',id:id,status:status},
				type:'get',
				success:function(res) {
					if(res.status==1){
						that.html(res.info)
					}else{
						wxc.xcConfirm("操作失败,请重试","error");
					}
				}
			})	
		// }});
	})
</script>
</body>
</html>
